import React from 'react'
import ReactDOM from 'react-dom'
import Router from 'react-router/lib/router'
import hashHistory from 'react-router/lib/hashHistory'
import { syncHistoryWithStore } from 'react-router-redux/'
import Root from './root'
import routes from './routes.js'
import createStore from './store/createStore'

const initialState = window.___INITIAL_STATE__
const store = createStore(initialState, hashHistory)
const history = syncHistoryWithStore(hashHistory,store)



// 主入口程序
const MOUNT_NODE = document.getElementById('app')

let render = (routerKey = null) => {

    ReactDOM.render(
        <Root
            history={history}
            routes={routes}
            routerKey={routerKey}
            store={store}
        />,
        MOUNT_NODE
    )

}


render()
